<?php

//Person
class Form_Person_Create extends Base_Form
{
    public function init()
    {
		$this->addElements(array(
			// Add an hidden element
            new Zend_Form_Element_Hidden('fid', array(
                'required'   => true,
				'decorators' =>array(
					'ViewHelper', 'Errors',
				),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(12,12))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('name', array(
                'required'   => true,
                'label'      => 'Name:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(4,30))
                )
            )),
            new Zend_Form_Element_Radio('gender', array(
                'required'   => true,
                'label'      => 'Gender:',
                'multiOptions' => array(
                    'Male'   => 'Male',
                    'Female' => 'Female',
                ),
                'separator'  => '',
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'Male','Female'
						)
					))
                )
            )),
            new Zend_Form_Element_Select('national', array(
                'required'   => true,
                'label'      => 'National:',
                'multiOptions' => array(
                    'Han' => 'Han',
                    'Mongolian' => 'Mongolian',
                    'Yi' => 'Yi',
                    'Dong' => 'Dong',
                    'Kazak' => 'Kazak',
                    'She' => 'She',
                    'Naxi' => 'Naxi',
                    'Mulao' => 'Mulao',
                    'Gelao' => 'Gelao',
                    'Nu' => 'Nu',
                    'Bonan' => 'Bonan',
                    'Oroqen' => 'Oroqen',
                    'Hui' => 'Hui',
                    'Zhuang' => 'Zhuang',
                    'Yao' => 'Yao',
                    'Dai' => 'Dai',
                    'Gaoshan' => 'Gaoshan',
                    'Jingpo' => 'Jingpo',
                    'Qiang' => 'Qiang',
                    'Xibe' => 'Xibe',
                    'Ozbek' => 'Ozbek',
                    'Yugur' => 'Yugur',
                    'Hoche' => 'Hoche',
                    'Tibetan' => 'Tibetan',
                    'Buyi' => 'Buyi',
                    'Bai nationality' => 'Bai nationality',
                    'Li' => 'Li',
                    'Lahu' => 'Lahu',
                    'Kirgiz' => 'Kirgiz',
                    'Blang' => 'Blang',
                    'Achang' => 'Achang',
                    'Russians' => 'Russians',
                    'Jing' => 'Jing',
                    'Monba' => 'Monba',
                    'Uighur' => 'Uighur',
                    'Korean' => 'Korean',
                    'Tujia' => 'Tujia',
                    'Lisu' => 'Lisu',
                    'Aquarium' => 'Aquarium',
                    'Tu' => 'Tu',
                    'Salar' => 'Salar',
                    'Pumi' => 'Pumi',
                    'Ewenki' => 'Ewenki',
                    'Tatar' => 'Tatar',
                    'Lhoba' => 'Lhoba',
                    'Miao' => 'Miao',
                    'Manchu' => 'Manchu',
                    'Hani' => 'Hani',
                    'Wa' => 'Wa',
                    'Dongxiang' => 'Dongxiang',
                    'Daur' => 'Daur',
                    'Maonan' => 'Maonan',
                    'Tajik' => 'Tajik',
                    'Deang' => 'Deang',
                    'Dulong' => 'Dulong',
                    'Jino' => 'Jino',
                    'Other' => 'Other',
                ),
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'Han','Mongolian','Yi','Dong','Kazak','She','Naxi','Mulao','Gelao','Nu','Bonan','Oroqen','Hui','Zhuang','Yao','Dai','Gaoshan','Jingpo','Qiang','Xibe','Ozbek','Yugur','Hoche','Tibetan','Buyi','Bai nationality','Li','Lahu','Kirgiz','Blang','Achang','Russians','Jing','Monba','Uighur','Korean','Tujia','Lisu','Aquarium','Tu','Salar','Pumi','Ewenki','Tatar','Lhoba','Miao','Manchu','Hani','Wa','Dongxiang','Daur','Maonan','Tajik','Deang','Dulong','Jino','Other'
						)
					))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('id_number', array(
                'required'   => true,
                'label'      => 'Id number:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(4,30))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('birth_date', array(
                'required'   => true,
                'label'      => 'Birth date:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(4,30))
                )
            )),
            new Zend_Form_Element_Select('marital_status', array(
                'required'   => true,
                'label'      => 'Marital status:',
                'multiOptions' => array(
                    'Unmarried'  => 'Unmarried',
                    'First'  => 'First',
                    'Remarry'  => 'Remarry',
                    'Divorce'  => 'Divorce',
                    'Widowed'  => 'Widowed',
                ),
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'Unmarried','First','Remarry','Divorce','Widowed'
						)
					))
                )
            )),
            new Zend_Form_Element_Select('education', array(
                'required'   => true,
                'label'      => 'Education:',
                'multiOptions' => array(
                     'XiaoXue'  => 'Primary School',
                     'ChuZhong'  => 'Junior high school',
                     'GaoZhong'  => 'High School',
                     'ZhongZhuan'  => 'Secondary technical schools',
                     'JiGong'  => 'Technical School',
                     'BenKe'  => 'Undergraduate',
                     'DaXue'  => 'University and above',
                     'ZhuanKe'  => 'University College and College',
                     'QiTa'  => 'Other',
                ),
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'XiaoXue','ChuZhong','GaoZhong','ZhongZhuan','JiGong','BenKe','DaXue','ZhuanKe','QiTa'
						)
					))
                )
            )),
            new Zend_Form_Element_Radio('account_nature', array(
                'required'   => true,
                'label'      => 'Account nature:',
                'multiOptions' => array(
                    'Agriculture'  => 'Agriculture',
                    'Non-agricultural'  => 'Non-agricultural',
                ),
                'separator'  => '',
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'Agriculture','Non-agricultural'
						)
					))
                )
            )),
            new Zend_Form_Element_Radio('account_status', array(
                'required'   => true,
                'label'      => 'Account status:',
                'multiOptions' => array(
                    'Local'  => 'Local resident local accounts',
                    'Field'  => 'Local resident foreign accounts',
                ),
                'separator'  => '',
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'Local','Field'
						)
					))
                )
            )),
            new Zend_Form_Element_Radio('archiving_reason', array(
                'required'   => true,
                'label'      => 'Archiving reason:',
                'multiOptions' => array(
                    'Makeup' => 'Makeup',
                    'Move'   => 'Move',
                    'Birth'  => 'Birth',
                ),
                'separator'  => '',
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'Makeup','Move','Birth'
						)
					))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('archiving_created', array(
                'required'   => true,
                'label'      => 'Archiving created:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(4,30))
                )
            )),
            new Zend_Form_Element_Select('relationship', array(
                'required'   => true,
                'label'      => 'Relationship:',
                'multiOptions' => array(
                    'Master'  => 'Master',
                    'Spouse'  => 'Spouse',
                    'Children'  => 'Children',
                    'Brothers'  => 'Brothers and sisters',
                    'Grandson'  => 'Grandson',
                    'Parents'  => 'Parents',
                    'Daughter'  => 'Daughter',
                    'Other'  => 'Other',
                ),
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
                        'Master','Spouse','Children','Brothers','Grandson','Parents','Daughter','Other'
						)
					))
                )
            )),
            new Zend_Form_Element_Radio('policy_type', array(
                'required'   => true,
                'label'      => 'Policy type:',
                'multiOptions' => array(
                    'Town'  => 'Urban residents',
                    'Rural'  => 'Rural residents',
                ),
                'separator'  => '',
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
                        'Town','Rural'
						)
					))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Radio('statistics_type', array(
                'required'   => true,
                'label'      => 'Statistics type:',
                'value'      => 'Permanent',
                'multiOptions' => array(
                    'Permanent'  => 'Permanent residence',
                ),
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
                        'Permanent'
						)
					))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Select('management_type', array(
                'required'   => true,
                'label'      => 'Management type:',
                'multiOptions' => array(
                    'Worker'=> 'Service workers',
                    'Rural'=> 'Rural Management',
                    'Unemployed'=> 'Unemployed',
                    'Other'=> 'Other',
                    'Urban'=> 'Other urban management'
                ),
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
                        'Worker','Rural','Unemployed','Other','Urban'
						)
					))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('marriage_date', array(
                'required'   => false,
                'label'      => 'Marriage date:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Date')
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('marriage_first', array(
                'required'   => false,
                'label'      => 'Marriage first:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Date')
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('work', array(
                'required'   => false,
                'label'      => 'Work:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(6,30))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('work_units', array(
                'required'   => false,
                'label'      => 'Work units:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(12,60))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('account_place', array(
                'required'   => true,
                'label'      => 'Account place:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(16,255))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('living_place', array(
                'required'   => true,
                'label'      => 'Living place:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(16,255))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Radio('drop_reasons', array(
                'required'   => true,
                'label'      => 'Drop reasons:',
                'value'      => 'Not',
                'multiOptions' => array(
                    'Not'  => 'Not drop',
                    'Yes'  => 'Drop',
                ),
                'separator'  => '',
                'validators' => array(
                    array('InArray', false, array(array(
                        'Not', 'Yes'
						)
					))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('drop_date', array(
                'required'   => false,
                'label'      => 'Drop date:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Date')
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('order', array(
                'required'   => true,
                'label'      => 'Order:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Int')
                )
            )),
            new Zend_Form_Element_Radio('policy', array(
                'required'   => true,
                'label'      => 'Policy:',
                'value'      => 'yes',
                'multiOptions' => array(
                    'yes'  => 'Policy inside',
                    'not'  => 'Policy outside',
                ),
                'separator'  => '',
                'filters'    => array('StringTrim'),
                'validators' => array(
                    array('InArray', false, array(array(
						'yes','not'
						)
					))
                )
            )),
        ));

        $this->addDisplayGroup(
            array('name','gender','national','id_number','birth_date','marital_status','education','account_nature','account_status','archiving_reason','archiving_created','relationship','policy_type','statistics_type','management_type','marriage_date','marriage_first','work','work_units','account_place','living_place','drop_reasons','drop_date','death_date','order','policy'), 'person',
			array(
				'legend' => 'Person'
			)
		);
    }
}
